// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ViewProfileDialog.java

package com.boci.clientapp.profile;

import com.boci.clientapp.main.ClientAppLoader;
import com.boci.clientapp.main.TradingClientApp;
import com.boci.clientapp.profile.action.ViewProfileAction;
import com.boci.clientapp.profile.vo.AccountProfileVO;
import com.boci.common.ui.AbstractDialog;
import com.boci.common.util.MessagesConfigurator;
import com.boci.common.util.PerformanceLogger;
import com.boci.common.vo.ResponseVO;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Locale;
import javax.swing.*;
import javax.swing.border.LineBorder;

public class ViewProfileDialog extends AbstractDialog
{

    public ViewProfileDialog(TradingClientApp owner, boolean modal, Locale pLocale)
    {
        super(owner, modal, pLocale, true);
        initGUI();
        setText(pLocale);
    }

    public void setText(Locale pLocale)
    {
        super.setText(pLocale);
        currentLocale = pLocale;
        MessagesConfigurator msgConf = ClientAppLoader.getMessagesConfigurator();
        setTitle(msgConf.getUIMessages("PROFILE.VIEW_TITLE", pLocale));
        lblPersonalInformation.setText(msgConf.getUIMessages("PROFILE.PERSONAL_INFO", pLocale));
        lblEngName.setText(msgConf.getUIMessages("PROFILE.ENGLISH_NAME", pLocale));
        lblBankName.setText(msgConf.getUIMessages("PROFILE.BANK_NAME", pLocale));
        lblBankAccNo.setText(msgConf.getUIMessages("PROFILE.BANK_ACCT_NO", pLocale));
        lblAccNoNote1.setText(msgConf.getUIMessages("PROFILE.ACCT_NO_NOTE1", pLocale));
        lblAccNoNote2.setText(msgConf.getUIMessages("PROFILE.ACCT_NO_NOTE2", pLocale));
        lblHomeAddr.setText(msgConf.getUIMessages("PROFILE.HOME_ADDRESS", pLocale));
        lblDayTimePhone.setText(msgConf.getUIMessages("PROFILE.DAYTIME_PHONE", pLocale));
        lblEveningPhone.setText(msgConf.getUIMessages("PROFILE.EVENING_PHONE", pLocale));
        lblMobilePhone.setText(msgConf.getUIMessages("PROFILE.MOBILE_PHONE", pLocale));
        lblFaxNo.setText(msgConf.getUIMessages("PROFILE.FAX_NO", pLocale));
        lblEmailAddr.setText(msgConf.getUIMessages("PROFILE.EMAIL_ADDRESS", pLocale));
        lblAccPref.setText(msgConf.getUIMessages("PROFILE.ACCOUNT_PREF", pLocale));
        lblPreferLang.setText(msgConf.getUIMessages("PROFILE.PREFER_LANG", pLocale));
        lblDefaultAccNo.setText(msgConf.getUIMessages("PROFILE.DEFAULT_ACCT_NO", pLocale));
        btnUpdate.setText(msgConf.getUIMessages("PROFILE.UPDATE", pLocale));
        btnClose.setText(msgConf.getUIMessages("PROFILE.CLOSE", pLocale));
        String strPreferLang[] = msgConf.getMsgArray("", ClientAppLoader.getPrefer_Languages(), pLocale);
        cmbPreferLang.setModel(new DefaultComboBoxModel(strPreferLang));
        setFont(pLocale);
    }

    private void setFont(Locale pLocale)
    {
        lblPersonalInformation.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblAccPref.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblEngName.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblBankName.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblBankAccNo.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblHomeAddr.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblDayTimePhone.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblEveningPhone.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblMobilePhone.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblFaxNo.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblEmailAddr.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblPreferLang.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblDefaultAccNo.setFont(ClientAppLoader.getSmallBoldTextFont(pLocale));
        lblAccNoNote1.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblAccNoNote2.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblEngNameResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblBankNameResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblBankAccNoResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblHomeAddrResult1.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblHomeAddrResult2.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblHomeAddrResult3.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblDayTimePhoneResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblEveningPhoneResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblMobilePhoneResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblFaxNoResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblEmailAddrResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblPreferLangResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        lblDefaultAccNoResult.setFont(ClientAppLoader.getSmallPlainTextFont(pLocale));
        btnUpdate.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
        btnClose.setFont(ClientAppLoader.getPlainButtonFont(pLocale));
    }

    private void initGUI()
    {
        setSize(507, 447);
        getContentPane().setLayout(null);
        getContentPane().setBackground(Color.WHITE);
        lblPersonalInformation = new JLabel();
        lblPersonalInformation.setBackground(new Color(140, 143, 145));
        lblPersonalInformation.setForeground(new Color(255, 255, 255));
        lblPersonalInformation.setBorder(new LineBorder(new Color(140, 143, 145), 1, false));
        lblPersonalInformation.setOpaque(true);
        lblPersonalInformation.setBounds(5, 5, 489, 20);
        getContentPane().add(lblPersonalInformation);
        lblEngName = new JLabel();
        lblEngName.setHorizontalAlignment(4);
        lblEngName.setBounds(10, 25, 135, 20);
        getContentPane().add(lblEngName);
        lblEngNameResult = new JLabel();
        lblEngNameResult.setBounds(150, 25, 320, 20);
        getContentPane().add(lblEngNameResult);
        lblBankName = new JLabel();
        lblBankName.setHorizontalAlignment(4);
        lblBankName.setBounds(10, 45, 135, 20);
        getContentPane().add(lblBankName);
        lblBankNameResult = new JLabel();
        lblBankNameResult.setBounds(150, 45, 320, 20);
        getContentPane().add(lblBankNameResult);
        lblBankAccNo = new JLabel();
        lblBankAccNo.setHorizontalAlignment(4);
        lblBankAccNo.setBounds(10, 65, 135, 20);
        getContentPane().add(lblBankAccNo);
        lblBankAccNoResult = new JLabel();
        lblBankAccNoResult.setBounds(150, 65, 320, 20);
        getContentPane().add(lblBankAccNoResult);
        lblAccNoNote1 = new JLabel();
        lblAccNoNote1.setBounds(115, 85, 379, 20);
        getContentPane().add(lblAccNoNote1);
        lblAccNoNote2 = new JLabel();
        lblAccNoNote2.setBounds(115, 105, 378, 20);
        getContentPane().add(lblAccNoNote2);
        lblHomeAddr = new JLabel();
        lblHomeAddr.setHorizontalAlignment(4);
        lblHomeAddr.setBounds(10, 125, 135, 20);
        getContentPane().add(lblHomeAddr);
        lblHomeAddrResult1 = new JLabel();
        lblHomeAddrResult1.setBounds(150, 125, 320, 20);
        getContentPane().add(lblHomeAddrResult1);
        lblHomeAddrResult2 = new JLabel();
        lblHomeAddrResult2.setBounds(150, 145, 320, 20);
        getContentPane().add(lblHomeAddrResult2);
        lblHomeAddrResult3 = new JLabel();
        lblHomeAddrResult3.setBounds(150, 165, 320, 20);
        getContentPane().add(lblHomeAddrResult3);
        lblDayTimePhone = new JLabel();
        lblDayTimePhone.setHorizontalAlignment(4);
        lblDayTimePhone.setBounds(10, 185, 135, 20);
        getContentPane().add(lblDayTimePhone);
        lblDayTimePhoneResult = new JLabel();
        lblDayTimePhoneResult.setBounds(150, 185, 320, 20);
        getContentPane().add(lblDayTimePhoneResult);
        lblEveningPhone = new JLabel();
        lblEveningPhone.setHorizontalAlignment(4);
        lblEveningPhone.setBounds(10, 205, 135, 20);
        getContentPane().add(lblEveningPhone);
        lblEveningPhoneResult = new JLabel();
        lblEveningPhoneResult.setBounds(150, 205, 320, 20);
        getContentPane().add(lblEveningPhoneResult);
        lblMobilePhone = new JLabel();
        lblMobilePhone.setHorizontalAlignment(4);
        lblMobilePhone.setBounds(10, 225, 135, 20);
        getContentPane().add(lblMobilePhone);
        lblMobilePhoneResult = new JLabel();
        lblMobilePhoneResult.setBounds(150, 225, 320, 20);
        getContentPane().add(lblMobilePhoneResult);
        lblFaxNo = new JLabel();
        lblFaxNo.setHorizontalAlignment(4);
        lblFaxNo.setBounds(10, 245, 135, 20);
        getContentPane().add(lblFaxNo);
        lblFaxNoResult = new JLabel();
        lblFaxNoResult.setBounds(150, 245, 320, 20);
        getContentPane().add(lblFaxNoResult);
        lblEmailAddr = new JLabel();
        lblEmailAddr.setHorizontalAlignment(4);
        lblEmailAddr.setBounds(10, 265, 135, 20);
        getContentPane().add(lblEmailAddr);
        lblEmailAddrResult = new JLabel();
        lblEmailAddrResult.setBounds(150, 265, 320, 20);
        getContentPane().add(lblEmailAddrResult);
        lblAccPref = new JLabel();
        lblAccPref.setForeground(new Color(255, 255, 255));
        lblAccPref.setBackground(new Color(140, 143, 145));
        lblAccPref.setBorder(new LineBorder(new Color(140, 143, 145), 1, false));
        lblAccPref.setOpaque(true);
        lblAccPref.setBounds(5, 290, 490, 20);
        getContentPane().add(lblAccPref);
        lblPreferLang = new JLabel();
        lblPreferLang.setHorizontalAlignment(4);
        lblPreferLang.setBounds(10, 330, 135, 20);
        getContentPane().add(lblPreferLang);
        lblPreferLangResult = new JLabel();
        lblPreferLangResult.setBounds(150, 310, 320, 20);
        lblPreferLangResult.setBounds(150, 330, 320, 20);
        getContentPane().add(lblPreferLangResult);
        cmbPreferLang = new JComboBox();
        lblDefaultAccNo = new JLabel();
        lblDefaultAccNo.setHorizontalAlignment(4);
        lblDefaultAccNo.setBounds(10, 310, 135, 20);
        getContentPane().add(lblDefaultAccNo);
        lblDefaultAccNoResult = new JLabel();
        lblDefaultAccNoResult.setBounds(150, 310, 320, 20);
        getContentPane().add(lblDefaultAccNoResult);
        btnUpdate = new JButton();
        btnUpdate.setBounds(130, 355, 120, 25);
        btnUpdate.setActionCommand("UPDATE");
        btnUpdate.addActionListener(this);
        getContentPane().add(btnUpdate);
        btnClose = new JButton();
        btnClose.setBounds(253, 355, 120, 25);
        btnClose.setActionCommand("CLOSE");
        btnClose.addActionListener(this);
        getContentPane().add(btnClose);
    }

    public AccountProfileVO getAccountProfileVO()
    {
        return currentVO;
    }

    public void refresh(ResponseVO pResponseVO)
    {
        if(pResponseVO instanceof AccountProfileVO)
        {
            AccountProfileVO acctProfileVO = (AccountProfileVO)pResponseVO;
            currentVO = acctProfileVO;
            lblEngNameResult.setText(acctProfileVO.getEnglishName());
            lblBankNameResult.setText(acctProfileVO.getBankAccountName());
            lblBankAccNoResult.setText(acctProfileVO.getDisplayBankAccNo(currentLocale));
            lblHomeAddrResult1.setText(acctProfileVO.getHomeAddress1());
            lblHomeAddrResult2.setText(acctProfileVO.getHomeAddress2());
            lblHomeAddrResult3.setText(acctProfileVO.getHomeAddress3());
            lblDayTimePhoneResult.setText(acctProfileVO.getDaytimePhone());
            lblEveningPhoneResult.setText(acctProfileVO.getEveningPhone());
            lblMobilePhoneResult.setText(acctProfileVO.getMobilePhone());
            lblFaxNoResult.setText(acctProfileVO.getFaxNo());
            lblEmailAddrResult.setText(acctProfileVO.getEmail());
            String strPreferLang[] = ClientAppLoader.getPrefer_Languages();
            for(int i = 0; i < strPreferLang.length; i++)
                if(strPreferLang[i].equals(acctProfileVO.getPreferLang()))
                    lblPreferLangResult.setText(String.valueOf(cmbPreferLang.getItemAt(i)));

            lblDefaultAccNoResult.setText(acctProfileVO.getDefaultAccountNo());
            setDefFocus();
        } else
        if(pResponseVO == null)
        {
            PerformanceLogger.startAppTimer();
            String strActionType = "REFRESH";
            ViewProfileAction viewProfileAction = new ViewProfileAction();
            viewProfileAction.doProcess(getInputValue(strActionType), strActionType);
            PerformanceLogger.stopAppTimer();
            PerformanceLogger.doLog((new StringBuilder()).append("VIEW_PROFILE_DIALOG.").append(strActionType).toString());
        }
        if(ClientAppLoader.enablePreferLang())
        {
            lblPreferLang.setVisible(true);
            lblPreferLangResult.setVisible(true);
        } else
        {
            lblPreferLang.setVisible(false);
            lblPreferLangResult.setVisible(false);
        }
    }

    public void actionPerformed(ActionEvent e)
    {
        String strActionType = e.getActionCommand();
        PerformanceLogger.startAppTimer();
        ViewProfileAction viewProfileAction = new ViewProfileAction();
        viewProfileAction.doProcess(getInputValue(strActionType), strActionType);
        PerformanceLogger.stopAppTimer();
        PerformanceLogger.doLog((new StringBuilder()).append("VIEW_PROFILE_DIALOG.").append(strActionType).toString());
    }

    public HashMap getInputValue(String pActionType)
    {
        return new HashMap();
    }

    public void setDefFocus()
    {
        SwingUtilities.invokeLater(new Runnable() {

            public void run()
            {
                btnUpdate.requestFocus();
            }
        }
);
    }

    private JLabel lblPersonalInformation;
    private JLabel lblEngName;
    private JLabel lblEngNameResult;
    private JLabel lblBankName;
    private JLabel lblBankNameResult;
    private JLabel lblBankAccNo;
    private JLabel lblBankAccNoResult;
    private JLabel lblAccNoNote1;
    private JLabel lblAccNoNote2;
    private JLabel lblHomeAddr;
    private JLabel lblHomeAddrResult1;
    private JLabel lblHomeAddrResult2;
    private JLabel lblHomeAddrResult3;
    private JLabel lblDayTimePhone;
    private JLabel lblDayTimePhoneResult;
    private JLabel lblEveningPhone;
    private JLabel lblEveningPhoneResult;
    private JLabel lblMobilePhone;
    private JLabel lblMobilePhoneResult;
    private JLabel lblFaxNo;
    private JLabel lblFaxNoResult;
    private JLabel lblEmailAddr;
    private JLabel lblEmailAddrResult;
    private JLabel lblAccPref;
    private JLabel lblPreferLang;
    private JLabel lblPreferLangResult;
    private JComboBox cmbPreferLang;
    private JLabel lblDefaultAccNo;
    private JLabel lblDefaultAccNoResult;
    private JButton btnUpdate;
    private JButton btnClose;
    private AccountProfileVO currentVO;
    private Locale currentLocale;

}
